package com.srit.vgt.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Yyming
 * @version 10.0
 * Created by Yyming on 2021/1/20
 */
@Entity
@Table(name = "ecr_weigh")
@Getter
@Setter
public class EcrWeigh {

    @Column(length = 8)
    private Integer weighNum;

    @Column
    private Double weighPrice;

//    @Column(length = 10)
//    @Id
//    private String date;
//
//    @Column(length = 17)
//    @Id
//    private String ecrId;
    @EmbeddedId
    private EcrWeighKey ecrWeighKey = new EcrWeighKey();

    @Embeddable
    @EqualsAndHashCode
    public static class  EcrWeighKey implements Serializable{
        @Column(length = 10)
        private String date;

        @Column(length = 17)
        private String ecrId;

        public String getDate() {
            return date;
        }

        public void setDate(String date) {
            this.date = date;
        }

        public String getEcrId() {
            return ecrId;
        }

        public void setEcrId(String ecrId) {
            this.ecrId = ecrId;
        }
    }

    public String getDate() {
        return ecrWeighKey.date;
    }

    public void setDate(String date) {
        ecrWeighKey.date = date;
    }

    public String getEcrId() {
        return ecrWeighKey.ecrId;
    }

    public void setEcrId(String ecrId) {
        ecrWeighKey.ecrId = ecrId;
    }

}
